"use strict";
const redisManager = require('./redisManager');
const CONFIG = require('../../../../../common/config');
const moment = require('moment');
const async = require('async');
const luaUtil = require('../commonUtils/luaUtil');

const tokenCheckUtil = (function () {

    function tokenCheckUtil() {
    }

    /**
     * 检查token合法性
     * @author mk
     * @date  2018-5-30
     * @param token       必须   xxxxxx        需要验证的token
     * @param callback    验证成功失败
     */
    tokenCheckUtil.checkToken = function (token,callback) {
        //调用lua工具方法检查
        luaUtil.checkToken(token, function (luaErr, result) {
            if (luaErr) {
                console.log("authorizeUtil applyToken setApiKeyAndToken err" + luaErr);
                return callback(luaErr, null);
            }
            return callback(null,result);
        });
    };




    return tokenCheckUtil;
})();

module.exports = tokenCheckUtil;